package com.future.mayi.utils;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;


public class HtmlFormat {
    public static String getNewContent(String htmltext) {
//        Document doc = Jsoup.parse(htmltext);
//        Elements head = doc.getElementsByTag("head");
//        if (head != null && head.size() > 0)
//            head.get(0).html("<style>*,body,html,div,p,img{border:0;margin:0;padding:0;}</style>");
//        Elements elements = doc.getElementsByTag("img");
//        for (Element element : elements) {
//            element.attr("width", "100%")
//                    .attr("height", "auto")
//                    .attr("style", "");
//        }
//
//        return doc.toString();


//        Document doc = Jsoup.parse(htmltext);
//        Elements elements = doc.getElementsByTag("img");
//        for (Element element : elements) {
//            element.attr("width", "100%").attr("height", "auto").attr("style","");
//        }
//        return doc.toString();

//        htmltext = "<header><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'><style>img{max-width:100%}</style></header>" + htmltext;
        return htmltext;
    }
}
